package com.wman.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.util.AttributeSet;
import android.view.View;

import com.wman.sheep.common.utils.DensityUtil;

import androidx.annotation.Nullable;

/**
 * @ProjectName: wman
 * @Package: com.wman
 * @ClassName: PointView
 * @Description: java类作用描述
 * @Author: wman
 * @CreateDate: 2019/11/8 17:01
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/11/8 17:01
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class PointView extends View {
    Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    Point point = new Point(0, 0);

    public PointView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    {
        mPaint.setStrokeWidth(DensityUtil.dip2px(15));
        mPaint.setStrokeCap(Paint.Cap.ROUND);
    }

    public Point getPoint() {
        return point;
    }

    public void setPoint(Point point) {
        this.point = point;
        invalidate();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        canvas.drawPoint(point.x, point.y, mPaint);
    }
}
